package com.kkb.retailer.center.server.service;


import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

import com.kkb.retailer.center.api.BrandInfoService;
import com.kkb.retailer.center.common.pojo.BrandInfo;
import com.kkb.retailer.center.server.mappers.BrandInfoMapper;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;
import tk.mybatis.mapper.entity.Example;

import java.util.List;


@Service
public class BrandInfoServiceImpl implements BrandInfoService {


    @Autowired
    private BrandInfoMapper brandInfoMapper;


    @Override
    public PageInfo<BrandInfo> getBrand(Integer pageNo, Integer pageSize) {
        PageHelper.startPage(pageNo,pageSize);
        Example example = new Example(BrandInfo.class);
        example.setOrderByClause("id desc");
        List<BrandInfo> allBrandList = brandInfoMapper.selectByExample(example);
        PageInfo<BrandInfo> pageInfo = new PageInfo<>(allBrandList);
        return pageInfo;
    }

    @Override
    public List<BrandInfo> getAllBrand() {
        List<BrandInfo> allBrandList = brandInfoMapper.selectAll();

        return allBrandList;
    }
}
